<?php

class NRegistryFormat extends NObject
{

	function &getInstance($format)
	{
		static $instances;

		if (!isset ($instances)) {
			$instances = array ();
		}

	//	$format = strtolower(JFilterInput::clean($format, 'word'));
		if (empty ($instances[$format]))
		{
			$class = 'NRegistryFormat'.$format;
			if(!class_exists($class))
			{
				$path    = dirname(__FILE__).DS.'format'.DS.$format.'.php';
				
				if (file_exists($path)) {

					require_once($path);
				} else {

					NError::raiseError(500,NText::_('Unable to load format class'));
				}
			}

			$instances[$format] = new $class ();
		}
		return $instances[$format];
	}


	function stringToObject( $data, $namespace='' ) {
		return true;
	}

	/**
	 * Converts an object into a formatted string
	 *
	 * @abstract
	 * @access	public
	 * @param	object	$object	Data Source Object
	 * @return	string	Formatted string
	 * @since	1.5
	 */
	function objectToString( &$object ) {

	}
}